var url = location.search; //获取url中"?"符后的字串 ('?modFlag=business&role=1')
console.log(url);
var sp=url.split("?");
var a=location.search.split("=")[1];
console.log(a);
$(document).ready(function () {

        $.ajax({
                type: 'post',
                url:"http://39.108.233.68:8080/selOneCityById" ,
                data: {
                    id: a,
                },
                datatype:'json',
                success: function (data) {
                    var data1=JSON.stringify(data);
                    console.log(data1);
                    // alert("success");

                    $("#change_cityid").val(data.data.id);
                    $("#change_cityname").val(data.data.cityname);
                    $("#change_citydescribetion").val(data.data.describetion)


                },
                error: function () {
                    alert("error");
                }
            }
        )
    }
)
$(function () {
    $("#change_city_submit").click(function () {

        var id = document.getElementById("change_cityid").value;
        var cityname = document.getElementById("change_cityname").value;
        var describetion = document.getElementById("change_citydescribetion").value;



        if(change_cityid!=""&& change_citydescribetion!=""&& change_cityname!="") {

            $.ajax({
                    type: 'post',
                    url:"http://39.108.233.68:8080/updOneCity" ,
                    data: {
                        id:id,
                        cityname:cityname,
                        describetion:describetion,


                    },

                    success: function (data) {

                        alert("修改成功！");
                    },
                    error: function () {
                        alert("error");
                    }
                }
            )
        }


        else {
            alert("所有内容均不能为空！")
        }
    })
})

